<link rel="stylesheet" href="<?php echo Yii::app()->params['urlImages']; ?>lib_upload/css/swfupload.css" type="text/css" />
<script type="text/javascript" src="<?php echo Yii::app()->params['urlImages']; ?>lib_upload/js/swfupload.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->params['urlImages']; ?>lib_upload/js/swfupload.queue.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->params['urlImages']; ?>lib_upload/js/fileprogress.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->params['urlImages']; ?>lib_upload/js/handlers.js"></script>

<script type="text/javascript" src="<?php echo Yii::app()->params['tiny_url_cp'];?>js/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->params['static_url_cp'];?>js/tinymce_submit.js"></script>   

<?php
    $forder_upload = "icon_app_sms_kute";    
    $link_upload = Yii::app()->params["urlImages"]."upload_icon_app_sms_kute.php?forder_upload=" . $forder_upload;
?>

<script type="text/javascript">    
    window.onload = function() {
        var configUploadData = {
            flash_url:"<?php echo Yii::app()->params["urlImages"];?>lib_upload/js/swfupload.swf",
            create_date:<?php echo $data["create_date"];?>,
            button_image_url:"<?php echo Yii::app()->params["urlImages"];?>lib_upload/images/buttonUpload.png",
            upload_url: "<?php echo $link_upload;?>", 
            file_types: "*.jpg;*.jpeg;*.png;*.gif", 
            file_upload_limit : 20, 
            file_queue_limit : 1, 
            debug : false
        }
        
        configUpload(configUploadData);         
    }; 
    function uploadResponse(serverData){  
        try {
            $("#txtFileName").val(""); 
            var response = $.parseJSON(serverData); // eval( "(" + serverData + ")" );      
            if(response.code==404){
                alert(response.message);return false;
            }  
            var filename = response.filename;    
            var path = response.path;
            var message = response.message;
            var code = response.code;
            var extension = response.extension;
            var filesize = response.filesize;
            $("#picture").val(filename);
            $("#show_pic").html('<img src="<?php echo Yii::app()->params["urlImages"].$forder_upload.'/';?>'+path +'/'+ filename +'" class="img-100" alt="pic">')
        } catch (e) {

        };
    }
    
</script>

<div class="main clearfix">
    <div class="Tabs clearfix">
        <ul class="clearfix">
            <li><a href="<?php echo Url::createUrl("appSmsKuteNew/index");?>" class="active"><span>App Sms Kute</span></a></li>
            <li><a href="<?php echo Url::createUrl("smsKuteNew/index");?>"><span>Sms Kute</span></a></li>                        
        </ul>                
    </div>

    <div class="box clearfix bottom30">
        <p><strong class="s18">Thêm mới app sms kute</strong></p>
        <form action="" method="POST" enctype="multipart/form-data">
            <ul class="form4">
                <?php if(!empty($error)) { ?>
                <li class="clearfix">
                    <label><strong>&nbsp;</strong></label>
                    <div class="filltext" style="color: red;">
                        <?php echo $error;?>
                    </div>
                </li>
                <?php }?>
                
                <li class="clearfix">
                    <label><strong>Tên app sms kute</strong>:</label>
                    <div class="filltext">
                        <input type="text" name="title" style="width:170px" value="<?php if(isset($data["title"])) echo $data["title"];?>">
                    </div>
                </li>

                <li class="clearfix"><label><strong>Ảnh minh họa </strong>:</label>
                    <div class="filltext">
                        <p>
                            <input type="hidden" id="txtFileName" readonly="readonly"/>
                            <input type="text" id="urlFile" style="border:1px solid #DFDFDF; width: 200px;">                            
                            <span id="spanButtonPlaceHolder"></span>
                        </p>
                        <p><i>Định dạng file: *.jpg;*.jpeg;*.png;*.gif(Dung lượng ko được quá 2 MB)</i></p>
                        <br/>
                        <div class="fieldset flash" id="fsUploadProgress">
                            <span class="legend">File upload</span>
                        </div>

                        <input type="hidden" name="picture" id="picture" value="<?php if(isset($data["picture"])) echo $data["picture"];?>"/>
                        <p id="show_pic">
                            <?php if(isset($data["picture"])){ ?>
                            <img src="<?php echo Common::getImageDomain($data["picture"], "icon_app_sms_kute", $data["create_date"], "", 2);?>" alt="">
                            <?php }?>
                        </p>
                    </div>
                </li>
                
                <li class="clearfix">
                    <label><strong>Tình trạng</strong>:</label>
                    <div class="filltext">
                        <select style="width:203px;margin-right:14px" name="status">                            
                            <option value="1" <?php if(isset($data["status"]) && $data["status"]=="1") echo "selected";?> >Hiển thị</option>
                            <option value="0" <?php if(isset($data["status"]) && $data["status"]=="0") echo "selected";?> >Ẩn</option>
                        </select>
                    </div>
                </li>
                <li class="clearfix">
                    <label><strong>Tóm tắt</strong>:</label>
                    <div class="filltext">
                        <textarea name="introtext" cols="5" rows="5" style="width:400px; height:120px" id="introtext"><?php if(isset($data["introtext"])) echo $data["introtext"];?></textarea>
                    </div>
                </li>
                <li class="clearfix">
                    <label><strong>Chi tiết</strong>:</label>
                    <div class="filltext">
                        <textarea name="description" cols="5" rows="5" style="width:400px; height:120px" id="description"><?php if(isset($data["description"])) echo $data["description"];?></textarea>
                    </div>
                </li>

                <li class="clearfix">
                    <label>&nbsp;</label>
                    <div class="filltext">
                        <input type="submit" value="Sửa" class="btn-bigblue"> 
                    </div>
                </li>
            </ul>
        </form>
    </div>
</div>